import { defineStore } from "pinia";
import { store } from "/@/store";

interface userState {
  isHidden: boolean;
  userInfo: any;
}

export const useUserStore = defineStore({
  id: "pure-user",
  state: (): userState => ({
    isHidden: true,
    userInfo: {}
  }),
  actions: {
    // 控制左侧树结构收缩
    isHiddenSetting() {
      this.isHidden = !this.isHidden;
    },

    setUserInfo(info) {
      this.userInfo = info;
    }
  }
});

export function useUserStoreHook() {
  return useUserStore(store);
}
